﻿<UserControl
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  xmlns:resx="clr-namespace:iTuner.Properties"
  mc:Ignorable="d"
  xmlns:local="clr-namespace:iTuner"
  x:Class="iTuner.ControlPanel"
  x:ClassModifier="internal"
  d:DesignWidth="240" d:DesignHeight="25">
  
  <UserControl.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Controls\VolumeSliderStyle.xaml"/>
      </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
  </UserControl.Resources>

  <Border CornerRadius="3" BorderThickness="1" BorderBrush="#FFC0C0C0">
    <Border.Background>
      <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FFE6E5E6" Offset="1"/>
        <GradientStop Color="#FF979B9D"/>
      </LinearGradientBrush>
    </Border.Background>
    <Grid Margin="7,0,7,0">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="18"/>
        <ColumnDefinition Width="20"/>
        <ColumnDefinition Width="18"/>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="65"/>
      </Grid.ColumnDefinitions>
      
      <Button
        x:Name="prevButton"
        VerticalAlignment="Center" Width="17" Height="17" Grid.Column="0"
        Style="{StaticResource ControlButtonStyle}" ToolTip="{x:Static resx:Resources.ControlPanel_PrevTrack}"
        Click="DoPreviousTrack" Focusable="False">
        <Path Data="M0,9 5,6 5,11.5z M10,6 10,11.5 5,9">
          <Path.Fill>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
              <LinearGradientBrush.RelativeTransform>
                <TransformGroup>
                  <RotateTransform Angle="-3.396" CenterX="0.5" CenterY="0.5"/>
                </TransformGroup>
              </LinearGradientBrush.RelativeTransform>
              <GradientStop Color="Black"/>
              <GradientStop Color="#FF8C8C8C" Offset="0.949"/>
            </LinearGradientBrush>
          </Path.Fill>
        </Path>
      </Button>

      <ToggleButton
        x:Name="playButton" Style="{StaticResource PlayButtonStyle}"
        Width="20" Height="20" Grid.Column="1" ToolTip="{x:Static resx:Resources.ControlPanel_PlayPause}"
        IsChecked="{Binding IsPlaying, Mode=OneWay}" Focusable="False"
        Click="DoPlayPause" />

      <Button
        x:Name="nextButton"
        VerticalAlignment="Center" Width="17" Height="17" Grid.Column="2"
        Style="{StaticResource ControlButtonStyle}" ToolTip="{x:Static resx:Resources.ControlPanel_NextTrack}"
        Click="DoNextTrack" Focusable="False">
        <Path Data="M1,6 1,11.5 6,9z M6,6 6,11.5 11,9">
          <Path.Fill>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
              <LinearGradientBrush.RelativeTransform>
                <TransformGroup>
                  <RotateTransform Angle="-3.396" CenterX="0.5" CenterY="0.5"/>
                </TransformGroup>
              </LinearGradientBrush.RelativeTransform>
              <GradientStop Color="Black"/>
              <GradientStop Color="#FF8C8C8C" Offset="0.949"/>
            </LinearGradientBrush>
          </Path.Fill>
        </Path>
      </Button>

      <local:VolumeControl
        x:Name="volumeControl"
        Height="12" Grid.Column="3" Margin="5,0.5,0,0"
        Volume="{Binding Volume, Mode=TwoWay}"/>

      <local:RatingControl
        Margin="5,0,0,0" Width="60" Height="12" Grid.Column="4"
        RatingValue="{Binding CurrentTrack.Rating, Mode=TwoWay}" />

    </Grid>
  </Border>
</UserControl>